<?php
    include('./dbconn.php');

    $user = $_GET["user"];
    $pw = $_GET["pw"];

    $sql = "select * from login_register where user='$user'";

    $result = $conn->query($sql);
    
    $row = mysqli_fetch_assoc($result);
    if($result->num_rows > 0){
        if($pw == $row["pw"]){
            $data["code"] = 0;
            $data["msp"] = '登陆成功';
        }else{
            $data["code"] = 1;
            $data["msp"] = '密码错误';
        }
    } else{
        $data['code'] = 2;
        $data['msp'] = '用户不存在';
    }
    echo json_encode($data);
?>